package com.gqzmy.springboot3.service.dto;

/**
 * @author 周小哥  gqzmy@163.com 2023/4/24 11:42
 */

public class ServiceResultDTO<T> {

    private boolean result = true;

    private String message;

    private T data;

    public static <T> ServiceResultDTO<T> init(Class<T> tClass) {
        return new ServiceResultDTO<>();
    }

    public ServiceResultDTO<T> fail(String message) {
        this.result = false;
        this.message = message;
        return this;
    }

    public ServiceResultDTO<T> message(String message) {
        this.message = message;
        return this;
    }

    public ServiceResultDTO<T> data(T data) {
        this.data = data;
        return this;
    }

    public boolean isSuccess() {
        return this.result;
    }

    public String getMessage() {
        return this.message;
    }

    public T getData() {
        return this.data;
    }
}
